﻿using System.Linq;
using SQLVis.Model;
using SQLVis.Presentation.ViewModel.Helpers;

namespace SQLVis.Presentation.ViewModel
{
	public partial class LayoutAnalyzerViewModel
	{

        //TODO: Hacer generador de grafos !!

		partial void CreateSampleGraphs()
		{
			#region SimpleTree

           // var graph= LogHelper.LoadSlowQueryLog(@"C:\Users\Shulian\Desktop\Tesis\mysql-slow.log");

            var graph = new PocGraph();

            for (int i = 0; i < 24; i++)
            {
                var v = new PocVertex("E_Table" + i.ToString(), (i * i == 0 ? 10 : i * i), i %4 );
                graph.AddVertex(v);
            }

            graph.AddEdge(new PocEdge("0to1", graph.Vertices.ElementAt(0), graph.Vertices.ElementAt(1)));
            graph.AddEdge(new PocEdge("1to2", graph.Vertices.ElementAt(1), graph.Vertices.ElementAt(2)));
            graph.AddEdge(new PocEdge("2to3", graph.Vertices.ElementAt(2), graph.Vertices.ElementAt(3)));
            graph.AddEdge(new PocEdge("2to4", graph.Vertices.ElementAt(2), graph.Vertices.ElementAt(4)));
            graph.AddEdge(new PocEdge("0to5", graph.Vertices.ElementAt(0), graph.Vertices.ElementAt(5)));
            graph.AddEdge(new PocEdge("1to7", graph.Vertices.ElementAt(1), graph.Vertices.ElementAt(7)));
            graph.AddEdge(new PocEdge("4to6", graph.Vertices.ElementAt(4), graph.Vertices.ElementAt(6)));
            graph.AddEdge(new PocEdge("4to6", graph.Vertices.ElementAt(4), graph.Vertices.ElementAt(6)));
            graph.AddEdge(new PocEdge("3to6", graph.Vertices.ElementAt(3), graph.Vertices.ElementAt(6)));
            graph.AddEdge(new PocEdge("6to7", graph.Vertices.ElementAt(6), graph.Vertices.ElementAt(7)));
            graph.AddEdge(new PocEdge("8to9", graph.Vertices.ElementAt(8), graph.Vertices.ElementAt(9)));
            graph.AddEdge(new PocEdge("4to6", graph.Vertices.ElementAt(6), graph.Vertices.ElementAt(19)));
            graph.AddEdge(new PocEdge("4to6", graph.Vertices.ElementAt(4), graph.Vertices.ElementAt(11)));
            graph.AddEdge(new PocEdge("4to6", graph.Vertices.ElementAt(11), graph.Vertices.ElementAt(20)));
             
            for (int j = 0; j < 24; j++)
            {
                if(j<23)
                    graph.AddEdge(new PocEdge(j.ToString() + "to" + (j+1).ToString(), graph.Vertices.ElementAt(j), graph.Vertices.ElementAt(j+1)));
            }


            GraphModels.Add(new GraphModel("Prototipo", graph));

			#endregion
		}
	}
}